
#import "LLBaseViewController.h"
#import "LLDefaultView.h"
#import "LLOAuthController.h"
#import "LLAccountTool.h"
@interface LLBaseViewController ()<LLDefaultViewDelegate>

@end

@implementation LLBaseViewController


- (void)loadView{
    
    if ([LLAccountTool readInShaHe]) {
        
        [super loadView];
    } else {
    
        LLDefaultView *defaultView = [LLDefaultView defaultView];
        self.view = defaultView;
        defaultView.delegate = self;
        self.defaultView = defaultView;
    }
}

#pragma mark - LLDefaultViewDelegate
- (void)defaultView:(LLDefaultView *)defaultView loginBtn:(UIButton *)loginBtn{
    
    
    // 1.获得网络监控的管理者
    AFNetworkReachabilityManager *mgr = [AFNetworkReachabilityManager sharedManager];
    
    // 2.设置网络状态改变后的处理
    [mgr setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        // 当网络状态改变了, 就会调用这个block
        switch (status) {
            case AFNetworkReachabilityStatusUnknown: // 未知网络
//                NSLog(@"未知网络");
                [SVProgressHUD showErrorWithStatus:@"未知网络" maskType:SVProgressHUDMaskTypeBlack];
                break;
                
            case AFNetworkReachabilityStatusNotReachable: // 没有网络(断网)
//                NSLog(@"没有网络(断网)");
                [SVProgressHUD showErrorWithStatus:@"没有网络(断网)" maskType:SVProgressHUDMaskTypeBlack];
                break;
                
            case AFNetworkReachabilityStatusReachableViaWWAN: // 手机自带网络
                NSLog(@"手机自带网络");
            case AFNetworkReachabilityStatusReachableViaWiFi: // WIFI
            {
                NSLog(@"WIFI");
                // 创建
                LLOAuthController *oauthVc = [[LLOAuthController alloc] init];
                UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:oauthVc];
                [self presentViewController:nav animated:YES completion:nil];

            }
                break;
        }
    }];
    
    // 3.开始监控
    [mgr startMonitoring];
    
    
    }

@end
